package com.eastfair.auth.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.auth.enumeration.ResourceOrganizationResourceTypeEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author ligang
 * @since 2021-08-30
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_resource_organization")
@ApiModel(value = "ResourceOrganization", description = "")
@AllArgsConstructor
public class ResourceOrganization extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 组织id
     */
    @ApiModelProperty(value = "组织id")
    @NotNull(message = "请填写组织id")
    @TableField(value = "organization_id")
    @Excel(name = "组织id")
    private Long organizationId;

    /**
     * 资源id
     */
    @ApiModelProperty(value = "资源id")
    @NotNull(message = "请填写资源id")
    @TableField(value = "resource_id")
    @Excel(name = "资源id")
    private Long resourceId;

    /**
     * 资源类型 #{project:项目;company:公司;sponsor:展会;host:主办;other:其他}
     */
    @ApiModelProperty(value = "资源类型 #{project:项目;company:公司;sponsor:展会;host:主办;other:其他}")
    @TableField(value = "resource_type")
    @Excel(name = "资源类型 #{project:项目;company:公司;sponsor:展会;host:主办;other:其他}", replace = {"项目_PROJECT", "公司_COMPANY", "展会_SPONSOR", "主办_HOST", "其他_OTHER",  "_null"})
    private ResourceOrganizationResourceTypeEnum resourceType;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnabled;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDeleted;

    /**
     * 项目id（分库分表用）
     */
    @ApiModelProperty(value = "项目id（分库分表用）")
    @TableField(value = "project_id")
    @Excel(name = "项目id（分库分表用）")
    private Long projectId;


    @Builder
    public ResourceOrganization(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    Long organizationId, Long resourceId, ResourceOrganizationResourceTypeEnum resourceType, Integer isEnabled, Integer isDeleted, Long projectId) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.organizationId = organizationId;
        this.resourceId = resourceId;
        this.resourceType = resourceType;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
    }

}
